package com.omg.persistence.dao.lifepoint.sqlmapdao;

import java.util.List;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;
import com.omg.persistence.dao.lifepoint.entity.LPActivity;
import com.omg.persistence.dao.lifepoint.iface.LPActivityDao;

/**
 * 
 * @author xiazhiquan
 * 
 *         May 28, 2011
 */
public class LPActivitySqlMapDao extends SqlMapDaoTemplate implements
		LPActivityDao {

	public LPActivitySqlMapDao(DaoManager daoManager) {
		super(daoManager);
	}

	@Override
	public LPActivity getActivityByActivityId(String activityid) {
		return (LPActivity) this.queryForObject("getActivityByActivityId",
				activityid);
	}

	@Override
	public List<LPActivity> getFeedsByUserid(String userid) {
		return this.queryForList("getFeedsByUserid", userid);
	}

	@Override
	public int addLPActivity(LPActivity activity) {
		try {
			this.insert("addLPActivity", activity);
			return 0;
		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}
	}

	@Override
	public int delLPActivity(String activityid) {
		try {
			this.delete("delLPActivity", activityid);
			return 0;
		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}
	}

	@Override
	public int updateLPActivity(LPActivity activity) {
		try {
			this.update("updateLPActivity", activity);
			return 0;
		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}
	}

}
